package com.example.pricecloudperformancetesting.utils;

import org.springframework.stereotype.Component;
import org.springframework.util.ResourceUtils;

import java.io.*;
import java.util.Properties;

/**
 * @author Remy
 * @description :
 * @date 2020-05-26 15:33
 */
@Component
public class ReadPropertiesConfig {
    private static Properties properties;

    static {
        properties = new Properties();
        try {
            File file = ResourceUtils.getFile("classpath:application.properties");
            InputStream inputStream = new FileInputStream(file);
            try {
                properties.load(inputStream);
            } catch (IOException e) {
                e.printStackTrace();
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }

    }

    public String getConfig(String key) {
        return properties.getProperty(key);
    }
}
